<?php

namespace Proj\ResManBundle\Entity;

use Doctrine\ORM\Mapping as ORM;

/**
 * Task
 *
 * @ORM\Table(name="task")
 * @ORM\Entity(repositoryClass="Proj\ResManBundle\Entity\Repository\TaskRepository")
 */
class Task {

    /**
     * @var integer
     *
     * @ORM\Column(name="id", type="integer")
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="AUTO")
     */
    private $id;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="startDate", type="datetime")
     */
    private $startDate;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="endDate", type="datetime")
     */
    private $endDate;

    /**
     * @var \DateTime
     *
     * @ORM\Column(name="createdDate", type="datetime")
     */
    private $createdDate;
    
    /**
     *
     * @var String $description
     * 
     * @ORM\Column(name="description", type="string")
     */
    private $description;
    
    /**
     * @ORM\ManyToOne(targetEntity="Activity", inversedBy="tasks")
     * @ORM\JoinColumn(name="activity_id", referencedColumnName="id")
     */
    private $activity;
    
    /**
     *
     * @var \Doctrine\Common\Collections\ArrayCollection
     * 
     * @ORM\ManyToMany(targetEntity="Person", inversedBy="tasks")
     * @ORM\JoinTable(
     *      name="task_people",
     *      joinColumns={@ORM\JoinColumn(name="task_id", referencedColumnName="id")},
     *      inverseJoinColumns={@ORM\JoinColumn(name="person_id", referencedColumnName="id")}
     * )
     */
    private $people;
    
    /**
     *
     * @var \Doctrine\Common\Collections\ArrayCollection
     * 
     * @ORM\OneToMany(targetEntity="TaskResources", mappedBy="task")
     */
    private $taskResources;
    
    
    public function __construct() {
        $this->setCreatedDate(new \DateTime);
    }

    /**
     * Get id
     *
     * @return integer 
     */
    public function getId() {
        return $this->id;
    }

    /**
     * Set startDate
     *
     * @param \DateTime $startDate
     * @return Task
     */
    public function setStartDate($startDate) {
        $this->startDate = $startDate;

        return $this;
    }

    /**
     * Get startDate
     *
     * @return \DateTime 
     */
    public function getStartDate() {
        return $this->startDate;
    }

    /**
     * Set endDate
     *
     * @param \DateTime $endDate
     * @return Task
     */
    public function setEndDate($endDate) {
        $this->endDate = $endDate;

        return $this;
    }

    /**
     * Get endDate
     *
     * @return \DateTime 
     */
    public function getEndDate() {
        return $this->endDate;
    }

    /**
     * Set createdDate
     *
     * @param \DateTime $createdDate
     * @return Task
     */
    public function setCreatedDate($createdDate) {
        $this->createdDate = $createdDate;

        return $this;
    }

    /**
     * Get createdDate
     *
     * @return \DateTime 
     */
    public function getCreatedDate() {
        return $this->createdDate;
    }
    
    /**
     * Sets the description
     * @param String $description
     */
    public function setDescription($description){
        $this->description = $description;
    }
    
    /**
     * Gets the description
     * @return String
     */
    public function getDescription(){
        return $this->description;
    }


    /**
     * Set activities
     *
     * @param \Proj\ResManBundle\Entity\Activity $activities
     * @return Task
     */
    public function setActivities(\Proj\ResManBundle\Entity\Activity $activities = null)
    {
        $this->activities = $activities;

        return $this;
    }

    /**
     * Get activities
     *
     * @return \Proj\ResManBundle\Entity\Activity 
     */
    public function getActivities()
    {
        return $this->activities;
    }

    /**
     * Set activity
     *
     * @param \Proj\ResManBundle\Entity\Activity $activity
     * @return Task
     */
    public function setActivity(\Proj\ResManBundle\Entity\Activity $activity = null)
    {
        $this->activity = $activity;

        return $this;
    }

    /**
     * Get activity
     *
     * @return \Proj\ResManBundle\Entity\Activity 
     */
    public function getActivity()
    {
        return $this->activity;
    }

    /**
     * Add people
     *
     * @param \Proj\ResManBundle\Entity\Person $people
     * @return Task
     */
    public function addPerson(\Proj\ResManBundle\Entity\Person $people)
    {
        $this->people[] = $people;

        return $this;
    }

    /**
     * Remove people
     *
     * @param \Proj\ResManBundle\Entity\Person $people
     */
    public function removePerson(\Proj\ResManBundle\Entity\Person $people)
    {
        $this->people->removeElement($people);
    }

    /**
     * Get people
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getPeople()
    {
        return $this->people;
    }

    /**
     * Add resources
     *
     * @param \Proj\ResManBundle\Entity\Resources $resources
     * @return Task
     */
    public function addResource(\Proj\ResManBundle\Entity\Resources $resources)
    {
        $this->resources[] = $resources;

        return $this;
    }

    /**
     * Remove resources
     *
     * @param \Proj\ResManBundle\Entity\Resources $resources
     */
    public function removeResource(\Proj\ResManBundle\Entity\Resources $resources)
    {
        $this->resources->removeElement($resources);
    }

    /**
     * Get resources
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getResources()
    {
        return $this->resources;
    }

    /**
     * Add taskResources
     *
     * @param \Proj\ResManBundle\Entity\TaskResources $taskResources
     * @return Task
     */
    public function addTaskResource(\Proj\ResManBundle\Entity\TaskResources $taskResources)
    {
        $this->taskResources[] = $taskResources;

        return $this;
    }

    /**
     * Remove taskResources
     *
     * @param \Proj\ResManBundle\Entity\TaskResources $taskResources
     */
    public function removeTaskResource(\Proj\ResManBundle\Entity\TaskResources $taskResources)
    {
        $this->taskResources->removeElement($taskResources);
    }

    /**
     * Get taskResources
     *
     * @return \Doctrine\Common\Collections\Collection 
     */
    public function getTaskResources()
    {
        return $this->taskResources;
    }
}
